/**
	ETFRoot project, Anyang Normal University && IMP-CAS
  \class ETFExpData
  \brief error propagation
	\author SUN Yazhou, asia.rabbit@163.com
  \since 2022-05-23
  \date 2022-06-24 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2022-05-23   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#include <TNamed.h>

# ifndef ETFExpData_H_
# define ETFExpData_H_

class ETFExpData : public TNamed{
public:
	ETFExpData(double val = 0., double err = 0.);
	virtual ~ETFExpData(){}

	ETFExpData(const ETFExpData &data);
	ETFExpData &operator=(const ETFExpData &data);

	void print() const;
	friend std::ostream &operator<<(std::ostream &os, const ETFExpData &data);

	double val() const{ return fVal; }
	double err() const{ return fErr; }
	void SetVal(double val){ fVal = val; }
	void SetErr(double err){ fErr = err; }

	const ETFExpData &operator+=(const ETFExpData &);
	const ETFExpData &operator-=(const ETFExpData &);
	const ETFExpData &operator*=(const ETFExpData &);
	const ETFExpData &operator/=(const ETFExpData &);
	ETFExpData operator+(const ETFExpData &) const;
	ETFExpData operator-(const ETFExpData &) const;
	ETFExpData operator*(const ETFExpData &) const;
	ETFExpData operator/(const ETFExpData &) const;

	ClassDef(ETFExpData, 1); // error propogation

protected:
	double fVal;
	double fErr;
};

ETFExpData Sqrt(const ETFExpData &p);
ETFExpData Log(const ETFExpData &p);
ETFExpData operator+(double k, const ETFExpData &p);
ETFExpData operator-(double k, const ETFExpData &p);
ETFExpData operator*(double k, const ETFExpData &p);
ETFExpData operator/(double k, const ETFExpData &p);
ETFExpData Exp(const ETFExpData &p);

# endif
